09. Wrapping readyState

Wrapping readyState

1.9 Wrapping readyState Quiz

Instructions

  1. In the workspace below, review the files in the Exercise folder.
  2. Set network throttling so that the page isn't ready instantly. (Also, it's generally a good practice to have some throttling when testing sites. It'll help you see your site's performance from your users' perspectives.)
  3. Wrap an event listener for readystatechange in a Promise.
  4. If document.readyState is not 'loading', resolve().
  5. Test by chaining wrapperResolved(). If all goes well, you should see "Resolved" on the page!

More about document.readyState

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity, so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: html-live
  • Opened files (when workspace is loaded): n/a

Solution

Feel free to check out the Solution folder in the workspace above. Here's how we did it:

1.9 Wrapping readyState Solution